﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Model;
using System.Collections.Generic;

public partial class Admin_Left_ContentManage : System.Web.UI.Page
{
    //类帮助服务
    GPI.Server.ClassService ClassServer = new GPI.Server.ClassService();
    //节点帮助服务
    GPI.Server.NodeService NodeServer = new GPI.Server.NodeService();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindList();
        }
    }

    /// <summary>
    /// 绑定列表
    /// </summary>
    private void BindList()
    {
        /*绑定列表*/
        //清空节点
        this.tvClass.Nodes.Clear();
        int i = 0;
        //获得列表
        List<ClassInfo> list = ClassServer.GetModelList("");
        foreach (ClassInfo tmp in list)
        {
            TreeNode node = new TreeNode();
            if (i == 0) this.hfClassId.Value = tmp.ID.ToString();
            node.Selected = i == 0 ? true : false;
            i++;
            node.Value = tmp.ID.ToString();
            node.Text = tmp.ClassName;
            foreach (TreeNode chNode in NodeServer.GetAllNodeByUrl(tmp.ID, "IframeOper"))
            {
                node.ChildNodes.Add(chNode);
            }
            this.tvClass.Nodes.Add(node);
        }


    }
}
